<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>佐心，教家长做父母</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
<c:set var="ctx" value="${pageContext.request.contextPath}" />
    <link rel="stylesheet" href="assets/css/amazeui.min.css">
    <link rel="stylesheet" href="assets/css/style.css?v=2.3">
    <link rel="stylesheet" href="assets/css/index.css?v=2.3">
    <script>
    var signUrl2=location.href.split('#')[0];
	if(signUrl2.indexOf("isappinstalled")>0){
		signUrl2=signUrl2.split('?')[0];
		location.href=signUrl2;
	}
    </script>
    <script>
    var temp=0;
     var direction="1";
     var type="";
     var server_id="";
    </script>
    <script>
    onload=function(){
    
    	var modelHtml="<div class='am-modal am-modal-confirm' tabindex='-1' id='my-confirm100'>";
			    modelHtml+="<div class='am-modal-dialog'>";
			    modelHtml+="    <div class='am-modal-hd'>佐心科技</div>";
			    modelHtml+="    <div class='am-modal-bd' id='alertMsg'>";
			           modelHtml+="";
			    modelHtml+="    </div>";
			    modelHtml+="    <div class='am-modal-footer'>";
			    modelHtml+="        <span class='am-modal-btn' data-am-modal-confirm>确定</span>";
			    modelHtml+="    </div>";
			    modelHtml+="</div>";
			modelHtml+="</div>";
			$("body").append(modelHtml);
    
    };
    function zhaoAlert(msg){
    	$("#alertMsg").text(msg);
    	$('#my-confirm100').modal({
            relatedTarget: this,
            onConfirm: function(options) {
            },
            // closeOnConfirm: false,
            onCancel: function() {

            }
        });
    }
    function goBack(){  
        location.href="index.jsp";
    }  
    </script>
</head>
<body class="bg-white">
<header data-am-widget="header" class="am-header am-header-default am-header-fixed am-border-bottom">
    <div class="am-header-left am-header-nav">
        <a  onclick="goBack();"  >
            <i class="icon_8"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        我要提问
    </h1>
</header>
<section class="am-padding-bottom-sm" id="amz-main" data-tag="css-nav">
    <!-- 选择领域-->
    <div class="icon_26 am-text-center font-color-12 margin-top-15 ">
        选择领域
    </div>
    <div class="am-g   am-g-collapse am-padding-left-sm margin-top-15 domaintype">
        <div class="am-u-sm-3 font-color-1 am-padding-right-sm">
            <div class="btn-17 cur"><span class="prelative">学业倦怠</span></div>
        </div>
        <div class="am-u-sm-3 font-color-1 am-padding-right-sm">
            <div class="btn-17"><span class="prelative">亲子关系</span></div>
        </div>
        <div class="am-u-sm-3 font-color-1 am-padding-right-sm">
            <div class="btn-17"><span class="prelative">教育理念</span></div>
        </div>
        <div class="am-u-sm-3 font-color-1 am-padding-right-sm">
            <div class="btn-17"><span class="prelative">学习习惯</span></div>
        </div>
        <div class="am-u-sm-3 font-color-1 am-padding-right-sm">
            <div class="btn-17"><span class="prelative">人际关系</span></div>
        </div>
        <div class="am-u-sm-3 font-color-1 am-padding-right-sm">
            <div class="btn-17"><span class="prelative">沉迷网络</span></div>
        </div>
        <div class="am-u-sm-3 font-color-1 am-padding-right-sm">
            <div class="btn-17"><span class="prelative">情绪管理</span></div>
        </div>
        <div class="am-u-sm-3 font-color-1 am-padding-right-sm">
            <div class="btn-17"><span class="prelative">自控能力</span></div>
        </div>
    </div>


    <!-- 问题描述-->
    <div class="icon_26 am-text-center font-color-12 am-margin-top-sm ">
        问题描述
    </div>

    <div class=" am-padding-sm font-14">
        <div class="border-1 font-color-16 am-padding-sm">
            <div class="wenxin">温馨提示：请尽可能详细的描述您先咨询的问题情况，以便高效获得专家的指导与建议。</div>
            <div class="margin-top-20 ">
                <textarea rows="4" id="txt_question_content" class="question_content am-hide" placeholder="请输入问题描述"></textarea>
            </div>
            <div class='bofan box-1 prelative' style="display:none">
			<div id="playVoice" class="btn_18 voice am-margin-bottom-sm">
			<input type='hidden'  value="">
                <i class="icon_711 "></i><span></span>
            </div>
            <i class="icon_43"></i>
            </div>
            <div class="box font-color-12">
                <div class="width-60px am-text-center" id="btntext">
                    <div class="icon_45"></div>
                    <div>文本</div>
                </div>
                <div class="width-60px am-text-center" id="btnvoice">
                    <div class="icon_46 " id="startRecord"></div>
                    <div ><span id="font_voice">语音</span></div>
                </div>
            </div>
        </div>

    </div>

    <div class="am-padding-sm">
        <div class="btn-4 word-space-2 padding-left-0" id="uploadVoice" onclick="addFreeAsk()">提交问题</div>
    </div>

    <div class="font-color-16 am-padding-left-sm am-padding-right-sm font-12">
    </div>

<!--隐藏音频-->
    <div class="am-hide">
        <audio src=""  id="audio">亲 您的浏览器不支持html5的audio标签</audio>
    </div>
    <div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">佐心科技</div>
        <div class="am-modal-bd">
            确定要删除您刚才上传的语音吗?
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn" data-am-modal-cancel>取消</span>
            <span class="am-modal-btn" data-am-modal-confirm>确定</span>
        </div>
    </div>
</div>
</section>

<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/amazeui.min.js"></script>

<script>

function addFreeAsk(){
	var question="";
	if(type=="1"){
		if(""==server_id){
			
			var modelHtml="<div class='am-modal am-modal-confirm' tabindex='-1' id='my-confirm1'>";
			    modelHtml+="<div class='am-modal-dialog'>";
			    modelHtml+="    <div class='am-modal-hd'>佐心科技</div>";
			    modelHtml+="    <div class='am-modal-bd'>";
			           modelHtml+="请录入语音内容";
			    modelHtml+="    </div>";
			    modelHtml+="    <div class='am-modal-footer'>";
			    modelHtml+="        <span class='am-modal-btn' data-am-modal-confirm>确定</span>";
			    modelHtml+="    </div>";
			    modelHtml+="</div>";
			modelHtml+="</div>";
			$("body").append(modelHtml);
						$('#my-confirm1').modal({
		                     relatedTarget: this,
		                     onConfirm: function(options) {
		                     },
		                     // closeOnConfirm: false,
		                     onCancel: function() {
		
		                     }
                		});
			return false;
		}
		question=server_id;
	}else if(type=="0"){
		if(""==$("#txt_question_content").val()){
			var modelHtml="<div class='am-modal am-modal-confirm' tabindex='-1' id='my-confirm3'>";
			    modelHtml+="<div class='am-modal-dialog'>";
			    modelHtml+="    <div class='am-modal-hd'>佐心科技</div>";
			    modelHtml+="    <div class='am-modal-bd'>";
			           modelHtml+="请输入需要询问的问题";
			    modelHtml+="    </div>";
			    modelHtml+="    <div class='am-modal-footer'>";
			    modelHtml+="        <span class='am-modal-btn' data-am-modal-confirm>确定</span>";
			    modelHtml+="    </div>";
			    modelHtml+="</div>";
			modelHtml+="</div>";
			$("body").append(modelHtml);
						$('#my-confirm3').modal({
		                     relatedTarget: this,
		                     onConfirm: function(options) {
		                     },
		                     // closeOnConfirm: false,
		                     onCancel: function() {
		
		                     }
                		});
			return false;
		}
		question=$("#txt_question_content").val();
	}else{
		var modelHtml="<div class='am-modal am-modal-confirm' tabindex='-1' id='my-confirm2'>";
			    modelHtml+="<div class='am-modal-dialog'>";
			    modelHtml+="    <div class='am-modal-hd'>佐心科技</div>";
			    modelHtml+="    <div class='am-modal-bd'>";
			           modelHtml+="请输入问题或语音内容";
			    modelHtml+="    </div>";
			    modelHtml+="    <div class='am-modal-footer'>";
			    modelHtml+="        <span class='am-modal-btn' data-am-modal-confirm>确定</span>";
			    modelHtml+="    </div>";
			    modelHtml+="</div>";
			modelHtml+="</div>";
			$("body").append(modelHtml);
						$('#my-confirm2').modal({
		                     relatedTarget: this,
		                     onConfirm: function(options) {
		                     },
		                     // closeOnConfirm: false,
		                     onCancel: function() {
		
		                     }
                		});
		return false;
	}
	if(temp==0){
		var modelHtml="<div class='am-modal am-modal-confirm' tabindex='-1' id='my-confirm5'>";
			    modelHtml+="<div class='am-modal-dialog'>";
			    modelHtml+="    <div class='am-modal-hd'>佐心科技</div>";
			    modelHtml+="    <div class='am-modal-bd'>";
			           modelHtml+="请输入问题或语音内容";
			    modelHtml+="    </div>";
			    modelHtml+="    <div class='am-modal-footer'>";
			    modelHtml+="        <span class='am-modal-btn' data-am-modal-confirm>确定</span>";
			    modelHtml+="    </div>";
			    modelHtml+="</div>";
			modelHtml+="</div>";
			$("body").append(modelHtml);
						$('#my-confirm5').modal({
		                     relatedTarget: this,
		                     onConfirm: function(options) {
		                     },
		                     // closeOnConfirm: false,
		                     onCancel: function() {
		
		                     }
                		});
		return false;
	}
	location.href="gotoMyQuestion?type="+type+"&question="+question+"&direction="+direction;
}

$(function(){
   $(".domaintype .btn-17").on("click",function(){
      $(".domaintype .btn-17").removeClass("cur");
       $(this).addClass("cur");
       direction=$(this).text();
       if(direction=="学业倦怠"){
       	direction="1";
       }else if(direction=="亲子关系"){
        direction="2";
       }else if(direction=="教育理念"){
        direction="3";
       }else if(direction=="学习习惯"){
        direction="4";
       }else if(direction=="人际关系"){
        direction="5";
       }else if(direction=="沉迷网络"){
        direction="6";
       }else if(direction=="情绪管理"){
        direction="7";
       }else if(direction=="自控能力"){
        direction="8";
       }
   });

    $("#btntext").on("click",function(){
    	temp=1;
    	$(".wenxin").hide();
 		type="0";
        var $voices=$("#btnvoice").find(".icon_46");
        $("#font_voice").text("语音");
       
        $voices.removeClass("cur");

        $("#txt_question_content").removeClass("am-hide").focus();

    });

		$(".icon_43").on("click",function(){
			$('#my-confirm').modal({
                        relatedTarget: this,
                        onConfirm: function(options) {
                          $(".bofan").hide();
						  temp=0;
                        },
                        // closeOnConfirm: false,
                        onCancel: function() {

                        }
                    });
		});
	
		//$(".voice").on("click",function(){
         ////   var audio = document.getElementById("audio");
        ////    audio.src=$(this).find("input").val(); 
        //    var eventTester = function(e){
        //        audio.addEventListener(e,function(){
        //            $voices.removeClass("cur");
        //        },false);
        //    };
        //    eventTester("ended");
        //  var $voices= $(this).find(".icon_711");
        //    $(".report_item .voice").find(".icon_711").remove("cur");
        //    if($voices.hasClass("cur")){
        //        $voices.removeClass("cur");
        //        audio.pause();
         //   }else{
        //        $voices.addClass("cur");
       //         audio.play();
       //     }

      //  });

    $("#btnvoice").on("click",function(){
    $(".wenxin").hide();
    	temp=1;
		type="1";
        $("#txt_question_content").addClass("am-hide");

        var $voices=$(this).find(".icon_46");
        if($voices.hasClass("cur")){
            $voices.removeClass("cur");
            $("#font_voice").text("点击开始");
            $("#yinyue").val();
			$(".btn_18").show();
			$(".icon_43").show();
			$(".bofan").show();
        } else{
            $voices.addClass("cur");
            $("#font_voice").text("点击结束");
        }

    });
});
</script>
<div style="display:none">
<h3 id="menu-basic" style="display:none">基础接口</h3>    
<span class="desc"  style="display:none">判断当前客户端是否支持指定JS接口</span>    
<button class="btn btn_primary" id="checkJsApi"  style="display:none">checkJsApi</button>    
<h3 id="menu-share"  style="display:none">分享接口</h3>    
<span class="desc"  style="display:none">获取“分享到朋友圈”按钮点击状态及自定义分享内容接口</span>    
<button class="btn btn_primary" id="onMenuShareTimeline"  style="display:none">onMenuShareTimeline</button>    
<span class="desc"  style="display:none">获取“分享给朋友”按钮点击状态及自定义分享内容接口</span>    
<button class="btn btn_primary" id="onMenuShareAppMessage"  style="display:none">onMenuShareAppMessage</button>    
<span class="desc"  style="display:none">获取“分享到QQ”按钮点击状态及自定义分享内容接口</span>    
<button class="btn btn_primary" id="onMenuShareQQ"  style="display:none">onMenuShareQQ</button>    
<span class="desc"  style="display:none">获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口</span>    
<button class="btn btn_primary" id="onMenuShareWeibo"  style="display:none">onMenuShareWeibo</button>       
<h3 id="menu-voice">音频接口</h3>    
<span class="desc">开始录音接口</span>    
<button class="btn btn_primary" id="startRecord2">startRecord</button>    
<span class="desc">停止录音接口</span>    
<button class="btn btn_primary" id="stopRecord">stopRecord</button>    
<span class="desc">播放语音接口</span>    
<button class="btn btn_primary" id="playVoice">playVoice</button>    
<span class="desc">暂停播放接口</span>    
<button class="btn btn_primary" id="pauseVoice">pauseVoice</button>    
<span class="desc">停止播放接口</span>    
<button class="btn btn_primary" id="stopVoice">stopVoice</button>    
<span class="desc">上传语音接口</span>    
<button class="btn btn_primary" id="uploadVoice">uploadVoice</button>    
<span class="desc">下载语音接口</span>    
<button class="btn btn_primary" id="downloadVoice">downloadVoice</button>    
<h3 id="menu-smart">智能接口</h3>    
<span class="desc">识别音频并返回识别结果接口</span>    
<button class="btn btn_primary" id="translateVoice">translateVoice</button>    
</div>
</body>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>   
<script>    
/*    
* 注意：    
* 1. 所有的JS接口只能在公众号绑定的域名下调用，公众号开发者需要先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”。    
* 2. 如果发现在 Android 不能分享自定义内容，请到官网下载最新的包覆盖安装，Android 自定义分享接口需升级至 6.0.2.58 版本及以上。    
* 3. 完整 JS-SDK 文档地址：http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html    
*    
* 如有问题请通过以下渠道反馈：    
* 邮箱地址：weixin-open@qq.com    
* 邮件主题：【微信JS-SDK反馈】具体问题    
* 邮件内容说明：用简明的语言描述问题所在，并交代清楚遇到该问题的场景，可附上截屏图片，微信团队会尽快处理你的反馈。    
*/   
var nonceStr;
var timestamp;
var signature;
var appId;
htmlobj=$.ajax({url:"getSign?url="+location.href.split('#')[0],async:false});
var json=JSON.parse(htmlobj.responseText);
signature=json.signature; 
nonceStr=json.nonceStr; 
timestamp=json.timestamp; 
appId=json.appId; 
wx.config({    
debug: false,    
appId: appId,    
timestamp: timestamp,    
nonceStr: nonceStr,    
signature: signature,    
jsApiList: [        
'checkJsApi',    
'onMenuShareTimeline',    
'onMenuShareAppMessage',    
'onMenuShareQQ',    
'onMenuShareWeibo',    
'hideMenuItems',    
'showMenuItems',    
'hideAllNonBaseMenuItem',    
'showAllNonBaseMenuItem',    
'translateVoice',    
'startRecord',    
'stopRecord',    
'onRecordEnd',    
'playVoice',    
'pauseVoice',    
'stopVoice',    
'uploadVoice',    
'downloadVoice',    
'chooseImage',    
'previewImage',    
'uploadImage',    
'downloadImage',    
'getNetworkType',    
'openLocation',    
'getLocation',    
'hideOptionMenu',    
'showOptionMenu',    
'closeWindow',    
'scanQRCode',    
'chooseWXPay',    
'openProductSpecificView',    
'addCard',    
'chooseCard',    
'openCard'
]    
});    
</script>    
<script src="js/luyinDemo.js"> </script>  
</html>